using System;
using System.Collections.Generic;
using System.Text;

namespace GAControl
{
    public class Transaction
    {
        private string _orderId, _affiliation, _city, _state, _country;
        private decimal _total, _tax, _shipping;
        /// <summary>
        /// Country 
        /// </summary>
        public string Country
        {
            get { return _country; }
            set { _country = value; }
        }
        /// <summary>
        /// State or province
        /// </summary>
        public string State
        {
            get { return _state; }
            set { _state = value; }
        }
        /// <summary>
        /// City to correlate the transaction with
        /// </summary>
        public string City
        {
            get { return _city; }
            set { _city = value; }
        }
        /// <summary>
        /// The shipping amount of the transaction
        /// </summary>
        public decimal Shipping
        {
            get { return _shipping; }
            set { _shipping = value; }
        }
        /// <summary>
        /// Tax amount of the transaction
        /// </summary>
        public decimal Tax
        {
            get { return _tax; }
            set { _tax = value; }
        }
        /// <summary>
        /// Total amount of the transaction
        /// </summary>
        public decimal Total
        {
            get { return _total; }
            set { _total = value; }
        }
        /// <summary>
        /// Optional partner or store affilation
        /// </summary>
        public string Affiliation
        {
            get { return _affiliation; }
            set { _affiliation = value; }
        }
        /// <summary>
        /// Your internal unique order id number
        /// </summary>
        public string OrderId
        {
            get { return _orderId; }
            set { _orderId = value; }
        }

        private List<Item> _items = new List<Item>();

        public List<Item> Items
        {
            get { return _items; }
        }

        internal string GetLines()
        {
            string output = string.Format("UTM:T|{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}\r\n", OrderId, Affiliation, Total.ToString(), Tax.ToString(), Shipping.ToString(), City, State, Country);
            foreach (Item item in Items)
            {
                output += item.GetLine(OrderId);
            }
            return output;
        }

    }
}
